package com.example.arithmeticleetcode.leetcode.nov;

import java.util.List;

/**
 * @program: arithmetic-leetcode
 * @description:
 * @author: FangZhen
 * @create: 2020-11-05 09:34
 **/
public class Demo2 {

    public static void main(String[] args) {
        int[][] indices = {{0,1},{1,1}};
        oddCells(2, 3, indices);
    }

    public static int oddCells(int n, int m, int[][] indices) {
        int[][] arr = new int[n][m];
        for (int[] index : indices) {
            for (int i = 0; i < m; i++) {
                arr[index[0]][i] += 1;
            }
            for (int i = 0; i < n; i++) {
                arr[i][index[1]] += 1;
            }
        }

        int count = 0;
        for (int[] ints : arr) {
            for (int anInt : ints) {
                if (anInt % 2 != 0) {
                    count++;
                }
            }
        }
        return count;
    }
}
